package com.tao.controller;


import com.tao.dto.MyResult;
import com.tao.dto.PageResult;
import com.tao.dto.SuccessResult;
import com.tao.entity.Account;
import com.tao.entity.RegisterCode;
import com.tao.service.AccountService;
import com.tao.service.RegisterCodeService;
import com.tao.util.CodeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value="账户controller",tags={"账户"})
@RestController
@CrossOrigin
public class AccountController {

    @Autowired
    AccountService accountService;




    @ApiOperation("账户增加")
    @PostMapping("/account/add")
    public MyResult add(@RequestBody Account account){

        Account insert = accountService.insert(account);
        return new SuccessResult("操作成功",insert);
    }

    @ApiOperation("账户获取")
    @GetMapping("/account/getALL")
    public MyResult getAll( ){
        List<Account> all = accountService.findAll();
        return new SuccessResult("获取成功",all);
    }


}
